package com.dmgis.hndz.controller;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.dmgis.hndz.common.utils.ExcelUtil;
import com.dmgis.hndz.pojoVo.Ggsy02bVO;
import com.dmgis.hndz.pojoVo.Jkca01gVO;
import com.dmgis.hndz.service.*;
import com.dmgis.hndz.common.utils.SysResult;
import com.dmgis.hndz.pojo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;

/**
 * @author 宁少永
 * @version 1.0
 * @adate 2024/2/6  -  9:42
 */
@Api(tags = "系统管理")
@RestController
@RequestMapping("/systemAdministration")
public class SystemAdministrationController {

    @Autowired
    private Ybab01aService ybab01aService;

    @Autowired
    private Ybab01bService ybab01bService;

    @Autowired
    private Ybab01cService ybab01cService;

    @Autowired
    private Ybab02aService ybab02aService;

    @Autowired
    private Ybab02cService ybab02cService;

    @Autowired
    private Ybab02dService ybab02dService;

    @Autowired
    private MessageSendService messageSendService;

    @Autowired
    private Ggsy02bService ggsy02bService;

    @Autowired
    private Jkca01gService jkca01gService;

    @ApiOperation("地质分析--查询")
    @PostMapping("/dzfxSelect")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query")
    })
    public SysResult dzfxSelect(String advcode) {
        Wrapper<Ybab01a> wrapper;
        if (advcode.endsWith("0000")) {
            wrapper = new LambdaQueryWrapper<Ybab01a>()
                    .isNull(Ybab01a::getYbab01a080);
        } else {
            wrapper = new LambdaQueryWrapper<Ybab01a>()
                    .eq(Ybab01a::getYbab01a080, advcode);
        }
        List<Ybab01a> list = ybab01aService.list(wrapper);

        if (list.size() == 0) {
            Wrapper<Ybab01a> wrapper2 = new LambdaQueryWrapper<Ybab01a>()
                    .isNull(Ybab01a::getYbab01a080);
            List<Ybab01a> list2 = ybab01aService.list(wrapper2);
            if (list2.size() > 0) {
                for (Ybab01a ybab01a : list2) {
                    //查询省级的预警参数
                    Wrapper<Ybab01b> wrapper01b = new LambdaQueryWrapper<Ybab01b>()
                            .eq(Ybab01b::getYbab01b020, ybab01a.getYbab01a010())
                            .isNull(Ybab01b::getYbab01b060);
                    List<Ybab01b> list01b = ybab01bService.list(wrapper01b);

                    int maxid = ybab01aService.getMaxId();
                    ybab01a.setYbab01a010(maxid + 1);
                    ybab01a.setYbab01a080(advcode);
                    // 将传入的对象所有非空属性都更新到数据库中
                    if (ybab01aService.getDataById(ybab01a.getYbab01a060()) == 0) {
                        ybab01aService.save(ybab01a);
                    }

                    for (Ybab01b ybab01b : list01b) {
                        ybab01b.setYbab01b010(java.util.UUID.randomUUID().toString().replace("-", ""));
                        ybab01b.setYbab01b020(maxid);
                        ybab01b.setYbab01b060(advcode);
                        ybab01bService.save(ybab01b);
                    }

                }
            }
            list = ybab01aService.list(wrapper);
        }


        return SysResult.success(list);
    }

    @ApiOperation("地质分析--删除")
    @PostMapping("/dzfxDelete")
    public SysResult dzfxDelete(String id) {
        // 将传入的对象所有非空属性都更新到数据库中
        boolean result = ybab01aService.remove(new LambdaQueryWrapper<Ybab01a>().eq(Ybab01a::getYbab01a060, id));

        if (result) {
            return SysResult.success("删除成功");
        } else {
            return SysResult.success("删除失败");
        }
    }

    @ApiOperation("地质分析--修改")
    @PostMapping("/dzfxUpdate")
    public SysResult dzfxUpdate(@RequestBody Ybab01a ybab01a) {
        // 创建UpdateWrapper实例并设置要更新的对象作为主键条件
        UpdateWrapper<Ybab01a> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("ybab01a010", ybab01a.getYbab01a010()); // Ybab01a的主键字段

        // 将传入的对象所有非空属性都更新到数据库中
        boolean result = ybab01aService.update(ybab01a, updateWrapper);

        if (result) {
            return SysResult.success("更新成功");
        } else {
            return SysResult.success("更新失败");
        }
    }

    @ApiOperation("地质分析--新增")
    @PostMapping("/dzfxSave")
    public SysResult dzfxSave(@RequestBody Ybab01a ybab01a) {
        ybab01a.setYbab01a060(java.util.UUID.randomUUID().toString().replace("-", ""));
        int maxid = ybab01aService.getMaxId();
        ybab01a.setYbab01a010(maxid);
        boolean result = ybab01aService.save(ybab01a);

        if (result) {
            return SysResult.success("操作成功");
        } else {
            return SysResult.success("操作失败");
        }
    }

    @ApiOperation("地质分析--设置面分析参数--查询")
    @PostMapping("/getAnalysisSurfaceParameters")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "factorindex", value = "因子索引，例如1 2 ", required = true, defaultValue = "", dataType = "Integer", paramType = "query")
    })
    public SysResult getAnalysisSurfaceParameters(int factorindex, String advcode) {
        // 创建一个Wrapper对象
        Wrapper<Ybab01b> wrapper;
        if (advcode.endsWith("0000")) {
            wrapper = new LambdaQueryWrapper<Ybab01b>()
                    .eq(Ybab01b::getYbab01b020, factorindex)
                    .isNull(Ybab01b::getYbab01b060);
        } else {
            wrapper = new LambdaQueryWrapper<Ybab01b>()
                    .eq(Ybab01b::getYbab01b020, factorindex)
                    .eq(Ybab01b::getYbab01b060, advcode);
        }
        List<Ybab01b> list = ybab01bService.list(wrapper);
        return SysResult.success(list);
    }

    @ApiOperation("地质分析--设置面分析参数--新增")
    @PostMapping("/saveAnalysisSurfaceParameters")
    public SysResult saveAnalysisSurfaceParameters(@RequestBody Ybab01b ybab01b) {
        ybab01b.setYbab01b010(java.util.UUID.randomUUID().toString().replace("-", ""));
        boolean result = ybab01bService.save(ybab01b);

        if (result) {
            return SysResult.success("操作成功");
        } else {
            return SysResult.success("操作失败");
        }
    }

    @ApiOperation("地质分析--设置面分析参数--删除")
    @PostMapping("/delAnalysisSurfaceParameters")
    public SysResult delAnalysisSurfaceParameters(String id) {

        boolean result = ybab01bService.remove(new LambdaQueryWrapper<Ybab01b>().eq(Ybab01b::getYbab01b010, id));

        if (result) {
            return SysResult.success("删除成功");
        } else {
            return SysResult.success("删除失败");
        }
    }

    @ApiOperation("地质分析--设置面分析参数--修改")
    @PostMapping("/upAnalysisSurfaceParameters")
    public SysResult upAnalysisSurfaceParameters(@RequestBody Ybab01b ybab01b) {
        // 创建UpdateWrapper实例并设置要更新的对象作为主键条件
        UpdateWrapper<Ybab01b> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("ybab01b010", ybab01b.getYbab01b010()); // Ybab01a的主键字段

        // 将传入的对象所有非空属性都更新到数据库中
        boolean result = ybab01bService.update(ybab01b, updateWrapper);

        if (result) {
            return SysResult.success("更新成功");
        } else {
            return SysResult.success("更新失败");
        }
    }

    @ApiOperation("地质分析--分因子显示参数--查询")
    @PostMapping("/getFactorDisplayParameters")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "factorindex", value = "因子索引，例如1 2 ", required = true, defaultValue = "", dataType = "String", paramType = "query")
    })
    public SysResult getFactorDisplayParameters(String factorindex, String advcode) {
        // 创建一个Wrapper对象
        Wrapper<Ybab01c> wrapper;
        if (advcode.endsWith("0000")) {
            wrapper = new LambdaQueryWrapper<Ybab01c>()
                    .eq(Ybab01c::getYbab01c020, factorindex)
                    .and(wrap -> wrap.isNull(Ybab01c::getYbab01c060).or().eq(Ybab01c::getYbab01c060, ""));
        } else {
            wrapper = new LambdaQueryWrapper<Ybab01c>()
                    .eq(Ybab01c::getYbab01c020, factorindex)
                    .eq(Ybab01c::getYbab01c060, advcode);
        }
        return SysResult.success(ybab01cService.list(wrapper));
    }

    @ApiOperation("地质分析--分因子显示参数--新增")
    @PostMapping("/saveFactorDisplayParameters")
    public SysResult saveFactorDisplayParameters(@RequestBody Ybab01c ybab01c) {
        ybab01c.setYbab01c010(java.util.UUID.randomUUID().toString().replace("-", ""));
        boolean result = ybab01cService.save(ybab01c);

        if (result) {
            return SysResult.success("操作成功");
        } else {
            return SysResult.success("操作失败");
        }
    }

    @ApiOperation("地质分析--分因子显示参数--删除")
    @PostMapping("/delFactorDisplayParameters")
    public SysResult delFactorDisplayParameters(String id) {

        boolean result = ybab01cService.remove(new LambdaQueryWrapper<Ybab01c>().eq(Ybab01c::getYbab01c010, id));

        if (result) {
            return SysResult.success("删除成功");
        } else {
            return SysResult.success("删除失败");
        }
    }

    @ApiOperation("地质分析--分因子显示参数--修改")
    @PostMapping("/upFactorDisplayParameters")
    public SysResult upFactorDisplayParameters(@RequestBody Ybab01c ybab01c) {
        // 创建UpdateWrapper实例并设置要更新的对象作为主键条件
        UpdateWrapper<Ybab01c> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("ybab01c010", ybab01c.getYbab01c010()); // Ybab01a的主键字段

        // 将传入的对象所有非空属性都更新到数据库中
        boolean result = ybab01cService.update(ybab01c, updateWrapper);

        if (result) {
            return SysResult.success("更新成功");
        } else {
            return SysResult.success("更新失败");
        }
    }


    @ApiOperation("地质分析--综合因子显示参数--查询")
    @PostMapping("/getAllDisplayParameters")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "factorindex", value = "因子索引，传-1", required = true, defaultValue = "", dataType = "String", paramType = "query")
    })
    public SysResult getAllDisplayParameters(String factorindex, String advcode) {
        // 创建一个Wrapper对象
        Wrapper<Ybab01c> wrapper;
        if (advcode.endsWith("0000")) {
            wrapper = new LambdaQueryWrapper<Ybab01c>()
                    .eq(Ybab01c::getYbab01c020, factorindex)
                    .and(wrap -> wrap.isNull(Ybab01c::getYbab01c060).or().eq(Ybab01c::getYbab01c060, ""));
        } else {
            wrapper = new LambdaQueryWrapper<Ybab01c>()
                    .eq(Ybab01c::getYbab01c020, factorindex)
                    .eq(Ybab01c::getYbab01c060, advcode);
        }

        return SysResult.success(ybab01cService.list(wrapper));
    }

    @ApiOperation("地质分析--综合因子显示参数--新增")
    @PostMapping("/saveAllDisplayParameters")
    public SysResult saveAllDisplayParameters(@RequestBody Ybab01c ybab01c) {
        ybab01c.setYbab01c010(java.util.UUID.randomUUID().toString().replace("-", ""));
        boolean result = ybab01cService.save(ybab01c);

        if (result) {
            return SysResult.success("操作成功");
        } else {
            return SysResult.success("操作失败");
        }
    }

    @ApiOperation("地质分析--综合因子显示参数--删除")
    @PostMapping("/delAllDisplayParameters")
    public SysResult delAllDisplayParameters(String id) {

        boolean result = ybab01cService.remove(new LambdaQueryWrapper<Ybab01c>().eq(Ybab01c::getYbab01c010, id));

        if (result) {
            return SysResult.success("删除成功");
        } else {
            return SysResult.success("删除失败");
        }
    }

    @ApiOperation("地质分析--综合因子显示参数--修改")
    @PostMapping("/upAllDisplayParameters")
    public SysResult upAllDisplayParameters(@RequestBody Ybab01c ybab01c) {
        // 创建UpdateWrapper实例并设置要更新的对象作为主键条件
        UpdateWrapper<Ybab01c> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("ybab01c010", ybab01c.getYbab01c010()); // Ybab01a的主键字段

        // 将传入的对象所有非空属性都更新到数据库中
        boolean result = ybab01cService.update(ybab01c, updateWrapper);

        if (result) {
            return SysResult.success("更新成功");
        } else {
            return SysResult.success("更新失败");
        }
    }

    @ApiOperation("地质分析--计算分因子grid")
    @PostMapping("/jsDisplayParameters")
    public SysResult jsDisplayParameters(@RequestBody Ybab01c ybab01c) {
        return SysResult.success("计算成功");
//        // 创建UpdateWrapper实例并设置要更新的对象作为主键条件
//        UpdateWrapper<Ybab01c> updateWrapper = new UpdateWrapper<>();
//        updateWrapper.eq("ybab01c010", ybab01c.getYbab01c010()); // Ybab01a的主键字段
//
//        // 将传入的对象所有非空属性都更新到数据库中
//        boolean result = ybab01cService.update(ybab01c, updateWrapper);
//
//        if (result) {
//            return SysResult.success("更新成功");
//        } else {
//            return SysResult.success("更新失败");
//        }
    }

    @ApiOperation("地质分析--计算综合因子grid")
    @PostMapping("/jsAllDisplayParameters")
    public SysResult jsAllDisplayParameters(@RequestBody Ybab01c ybab01c) {
        return SysResult.success("计算成功");
//        // 创建UpdateWrapper实例并设置要更新的对象作为主键条件
//        UpdateWrapper<Ybab01c> updateWrapper = new UpdateWrapper<>();
//        updateWrapper.eq("ybab01c010", ybab01c.getYbab01c010()); // Ybab01a的主键字段
//
//        // 将传入的对象所有非空属性都更新到数据库中
//        boolean result = ybab01cService.update(ybab01c, updateWrapper);
//
//        if (result) {
//            return SysResult.success("更新成功");
//        } else {
//            return SysResult.success("更新失败");
//        }
    }


    @ApiOperation("模型配置--得到所有模型")
    @PostMapping("/getAllModels")
    public SysResult getAllModels() {
        Wrapper<Ybab02c> wrapper = new LambdaQueryWrapper<Ybab02c>()
                .orderByAsc(Ybab02c::getYbab02c020);
        List<Ybab02c> list = ybab02cService.list(wrapper);
        return SysResult.success(list);
    }

    @ApiOperation("模型配置--根据行政编码得到得到模型")
    @PostMapping("/getModelByXzqh")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query")
    })
    public SysResult getModelByXzqh(String advcode) {
        Wrapper<Ybab02d> wrapper = new LambdaQueryWrapper<Ybab02d>();
//                .eq(Ybab02d::getYbab02d020, advcode);
        List<Ybab02d> list = ybab02dService.list(wrapper);

        List<Ybab02c> list2 = new ArrayList<>();
        if (list.size() > 0) {
            List<String> modelindexs = new ArrayList<>();
            for (Ybab02d ybab : list) {
                modelindexs.add(ybab.getYbab02d010());
            }

            Wrapper<Ybab02c> wrapper2 = new LambdaQueryWrapper<Ybab02c>()
                    .in(Ybab02c::getYbab02c020, modelindexs);
            list2 = ybab02cService.list(wrapper2);
        }

        return SysResult.success(list2);
    }

    @ApiOperation("模型配置--添加模型（ybab02c）")
    @PostMapping("/addModel")
    @ApiImplicitParam(name = "ybab02c", value = "模型信息", required = true, defaultValue = "", dataType = "Ybab02c", paramType = "body")
    public SysResult addModel(@RequestBody Ybab02c ybab02c) {
        ybab02c.setYbab02c010(java.util.UUID.randomUUID().toString().replace("-", ""));
        boolean result = ybab02cService.save(ybab02c);
        if (result) {
            return SysResult.success("操作成功");
        } else {
            return SysResult.fail("操作失败");
        }
    }

    @ApiOperation("模型配置--删除模型（ybab02c）")
    @PostMapping("/delModel")
    public SysResult delModel(String id) {
        boolean result = ybab02cService.remove(new LambdaQueryWrapper<Ybab02c>().eq(Ybab02c::getYbab02c010, id));
        if (result) {
            return SysResult.success("删除成功");
        } else {
            return SysResult.fail("删除失败");
        }
    }

    @ApiOperation("因子权重配置--添加")
    @PostMapping("/addFactorConfiguration")
    @ApiImplicitParam(name = "ybab02a", value = "配置信息", required = true, defaultValue = "", dataType = "Ybab02a", paramType = "body")
    public SysResult addFactorConfiguration(@RequestBody Ybab02a ybab02a) {
        ybab02a.setYbab02a010(java.util.UUID.randomUUID().toString().replace("-", ""));
        boolean result = ybab02aService.save(ybab02a);
        if (result) {
            return SysResult.success("操作成功");
        } else {
            return SysResult.fail("操作失败");
        }
    }

    @ApiOperation("因子权重配置--地质分区降雨模型00001--新增/删除/修改")
    @PostMapping("/upRainfallModelFactorConfiguration")
    @ApiImplicitParam(name = "ybab02aDtos", value = "配置信息", required = true, defaultValue = "", dataType = "Ybab02aDto", paramType = "body")
    public SysResult upRainfallModelFactorConfiguration(@RequestBody List<Ybab02aDto> ybab02aDtos) {
        boolean result = ybab02aService.upRainfallModelFactorConfiguration(ybab02aDtos);
        if (result) {
            return SysResult.success("操作成功");
        } else {
            return SysResult.fail("操作失败");
        }
    }

    @ApiOperation("因子权重配置--删除（ybab02a）")
    @PostMapping("/delFactorConfiguration")
    public SysResult delFactorConfiguration(String id) {
        boolean result = ybab02aService.remove(new LambdaQueryWrapper<Ybab02a>().eq(Ybab02a::getYbab02a010, id));
        if (result) {
            return SysResult.success("删除成功");
        } else {
            return SysResult.fail("删除失败");
        }
    }

    @ApiOperation("因子权重配置--查询")
    @PostMapping("/getFactorConfiguration")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "modelIndex", value = "模型代码", required = true, defaultValue = "", dataType = "String", paramType = "query")
    })
    public SysResult getFactorConfiguration(String advcode, String modelIndex) {
        // 创建一个Wrapper对象
        String ybab02a020 = modelIndex;
        Wrapper<Ybab02a> wrapper;
        if (advcode.endsWith("0000")) {
            wrapper = new LambdaQueryWrapper<Ybab02a>()
                    .eq(Ybab02a::getYbab02a020, ybab02a020)
                    .isNull(Ybab02a::getYbab02a060);
        } else {
            wrapper = new LambdaQueryWrapper<Ybab02a>()
                    .eq(Ybab02a::getYbab02a020, ybab02a020)
                    .eq(Ybab02a::getYbab02a060, advcode);
        }
        List<Ybab02a> list = ybab02aService.list(wrapper);
        if (modelIndex.equals("00001")) { // 当模型编码为00001时进行数据处理，处理成Ybab02aDto
            List<Ybab02aDto> ybab02aDtoList = new ArrayList<>();
            List<String> gradeName = new ArrayList<>();
            List<String> gradeStart = new ArrayList<>();
            List<String> gradeEnd = new ArrayList<>();
            List<String> y1_1 = new ArrayList<>();
            List<String> y1_2 = new ArrayList<>();
            List<String> y2_1 = new ArrayList<>();
            List<String> y2_2 = new ArrayList<>();
            List<String> y3_1 = new ArrayList<>();
            List<String> y3_2 = new ArrayList<>();
            List<String> y4_1 = new ArrayList<>();
            List<String> y4_2 = new ArrayList<>();
            List<String> y5_1 = new ArrayList<>();
            List<String> y5_2 = new ArrayList<>();
            for (Ybab02a ybab02a : list) {
                switch (ybab02a.getYbab02a040()) {
                    case "gradeName":
                        gradeName.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "gradeStart":
                        gradeStart.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "gradeEnd":
                        gradeEnd.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y1_1":
                        y1_1.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y1_2":
                        y1_2.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y2_1":
                        y2_1.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y2_2":
                        y2_2.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y3_1":
                        y3_1.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y3_2":
                        y3_2.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y4_1":
                        y4_1.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y4_2":
                        y4_2.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y5_1":
                        y5_1.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                    case "y5_2":
                        y5_2.addAll(Arrays.asList(ybab02a.getYbab02a050().split(",")));
                        break;
                }
            }
            for (int i = 0; i < gradeName.size(); i++) {
                Ybab02aDto ybab02aDto = new Ybab02aDto();
                ybab02aDto.setGradeName(gradeName.get(i));
                ybab02aDto.setGradeStart(gradeStart.get(i));
                ybab02aDto.setGradeEnd(gradeEnd.get(i));
                ybab02aDto.setY1_1(y1_1.get(i));
                ybab02aDto.setY1_2(y1_2.get(i));
                ybab02aDto.setY2_1(y2_1.get(i));
                ybab02aDto.setY2_2(y2_2.get(i));
                ybab02aDto.setY3_1(y3_1.get(i));
                ybab02aDto.setY3_2(y3_2.get(i));
                ybab02aDto.setY4_1(y4_1.get(i));
                ybab02aDto.setY4_2(y4_2.get(i));
                ybab02aDto.setY5_1(y5_1.get(i));
                ybab02aDto.setY5_2(y5_2.get(i));
                ybab02aDtoList.add(ybab02aDto);
            }
            return SysResult.success(ybab02aDtoList);
        }
        return SysResult.success(list);
    }

    @ApiOperation("因子权重配置--更新")
    @PostMapping("/updateFactorConfiguration")
    @ApiImplicitParam(name = "ybab02a", value = "配置信息", required = true, defaultValue = "", dataType = "Ybab02a", paramType = "body")
    public SysResult updateFactorConfiguration(@RequestBody Ybab02a ybab02a) {
        // 创建UpdateWrapper实例并设置要更新的对象作为主键条件
        UpdateWrapper<Ybab02a> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("ybab02a010", ybab02a.getYbab02a010()); // Ybab01a的主键字段
        // 将传入的对象所有非空属性都更新到数据库中
        boolean result = ybab02aService.update(ybab02a, updateWrapper);
        if (result) {
            return SysResult.success("更新成功");
        } else {
            return SysResult.fail("更新失败");
        }
    }

    @ApiOperation("因子权重配置--批量更新")
    @PostMapping("/batchUpdateFactorConfiguration")
    @ApiImplicitParam(name = "ybab02as", value = "批量配置信息", required = true, defaultValue = "", dataType = "Ybab02a", paramType = "body")
    public SysResult batchUpdateFactorConfiguration(@RequestBody Ybab02a[] ybab02as) {
        boolean result = ybab02aService.batchUpdate(ybab02as);
        if (result) {
            return SysResult.success("更新成功");
        } else {
            return SysResult.fail("更新失败");
        }
    }

    @ApiOperation("模型配置--添加模型")
    @PostMapping("/addModelByXzqh")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "modelIndex", value = "模型代码", required = true, defaultValue = "", dataType = "String", paramType = "query")
    })
    public SysResult addModelByXzqh(String advcode, String modelIndex) {
        Ybab02d ybab02d = new Ybab02d();
        ybab02d.setYbab02d010(modelIndex);
        ybab02d.setYbab02d020(advcode);
        // 判断模型是否已存在
        if (ybab02dService.selectYbab02dById(ybab02d) > 0) {
            return SysResult.fail("模型已存在！");
        }
        // 将传入的对象所有非空属性都更新到数据库中
        boolean result = ybab02dService.save(ybab02d);
        if (result) {
            return SysResult.success("操作成功");
        }
        return SysResult.success("操作失败");

    }

    @ApiOperation("模型配置--删除模型")
    @PostMapping("/delModelByXzqh")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "modelIndex", value = "模型代码", required = true, defaultValue = "", dataType = "String", paramType = "query")
    })
    public SysResult delModelByXzqh(String advcode, String modelIndex) {
        if (advcode.equals(""))
            return SysResult.success("操作失败，advcode不能为空");
        if (modelIndex.equals(""))
            return SysResult.success("操作失败，modelIndex不能为空");
        // 将传入的对象所有非空属性都更新到数据库中
        boolean result = ybab02dService.remove(new LambdaQueryWrapper<Ybab02d>()
                .eq(Ybab02d::getYbab02d010, modelIndex)
                .eq(Ybab02d::getYbab02d020, advcode));
        if (result) {
            return SysResult.success("操作成功");
        } else {
            return SysResult.success("操作失败");
        }
    }


    @ApiOperation("模型配置--短临/短期山东模型--查询")
    @PostMapping("/getModelConfiguration")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "modelIndex", value = "模型代码：短临00000，短期00002/00006", required = true, defaultValue = "", dataType = "String", paramType = "query")
    })
    public SysResult getModelConfiguration(String advcode, String modelIndex) {
        // 创建一个Wrapper对象
        String ybab02a020 = modelIndex;
        String ybab02a040 = "skyzSet";
        Wrapper<Ybab02a> wrapper;
        if (advcode.endsWith("0000")) {
            wrapper = new LambdaQueryWrapper<Ybab02a>()
                    .eq(Ybab02a::getYbab02a020, ybab02a020)
                    .eq(Ybab02a::getYbab02a040, ybab02a040)
                    .isNull(Ybab02a::getYbab02a060);
        } else {
            wrapper = new LambdaQueryWrapper<Ybab02a>()
                    .eq(Ybab02a::getYbab02a020, ybab02a020)
                    .eq(Ybab02a::getYbab02a040, ybab02a040)
                    .eq(Ybab02a::getYbab02a060, advcode);
        }

        List<Ybab02a> list = ybab02aService.list(wrapper);
        if (list.size() == 0) {
            Wrapper<Ybab02a> wrapper1 = new LambdaQueryWrapper<Ybab02a>()
                    .eq(Ybab02a::getYbab02a020, ybab02a020)
                    .eq(Ybab02a::getYbab02a040, ybab02a040)
                    .isNull(Ybab02a::getYbab02a060);
            List<Ybab02a> list1 = ybab02aService.list(wrapper1);
            if (list1.size() > 0) {
                Ybab02a ybab02a = new Ybab02a();
                ybab02a.setYbab02a010(java.util.UUID.randomUUID().toString().replace("-", ""));
                ybab02a.setYbab02a020(list1.get(0).getYbab02a020());
                ybab02a.setYbab02a030(list1.get(0).getYbab02a030());
                ybab02a.setYbab02a040(list1.get(0).getYbab02a040());
                ybab02a.setYbab02a050(list1.get(0).getYbab02a050());
                ybab02a.setYbab02a060(advcode);
                // 将传入的对象所有非空属性都更新到数据库中
                boolean result = ybab02aService.save(ybab02a);
            }

            list = ybab02aService.list(wrapper);
        }
        return SysResult.success(list);
    }

    @ApiOperation("模型配置--短临/短期山东模型--新增/删除/修改")
    @PostMapping("/upModelConfiguration")
    public SysResult upModelConfiguration(@RequestBody Ybab02a ybab02a) {
        String ybab02a020 = ybab02a.getYbab02a020();
        if (ybab02a020.equals(""))
            return SysResult.success("操作失败，ybab02a020不能为空");
        String ybab02a040 = ybab02a.getYbab02a040();
        if (ybab02a040.equals(""))
            return SysResult.success("操作失败，ybab02a040不能为空，赋值为skyzSet");
        String ybab02a050 = ybab02a.getYbab02a050();
        if (ybab02a050.equals(""))
            return SysResult.success("操作失败，ybab02a050不能为空，赋值为1,3,0.02;4,6,0.3;7,9,1格式");
        Wrapper<Ybab02a> wrapper;
        if (ybab02a.getYbab02a060() == null) {
            wrapper = new LambdaQueryWrapper<Ybab02a>()
                    .eq(Ybab02a::getYbab02a020, ybab02a020)
                    .eq(Ybab02a::getYbab02a040, ybab02a040)
                    .isNull(Ybab02a::getYbab02a060);
        } else {
            wrapper = new LambdaQueryWrapper<Ybab02a>()
                    .eq(Ybab02a::getYbab02a020, ybab02a020)
                    .eq(Ybab02a::getYbab02a040, ybab02a040)
                    .eq(Ybab02a::getYbab02a060, ybab02a.getYbab02a060());
        }
        List<Ybab02a> list = ybab02aService.list(wrapper);
        if (list.size() > 0) {
            // 创建UpdateWrapper实例并设置要更新的对象作为主键条件
            UpdateWrapper<Ybab02a> updateWrapper = new UpdateWrapper<>();
            updateWrapper.eq("ybab02a010", ybab02a.getYbab02a010()); // Ybab01a的主键字段
            // 将传入的对象所有非空属性都更新到数据库中
            boolean result = ybab02aService.update(ybab02a, updateWrapper);

            if (result) {
                return SysResult.success("操作成功");
            } else {
                return SysResult.success("操作失败");
            }
        } else {
            ybab02a.setYbab02a010(java.util.UUID.randomUUID().toString().replace("-", ""));
            ybab02a.setYbab02a020(ybab02a020);
            ybab02a.setYbab02a040(ybab02a040);
            ybab02a.setYbab02a060(ybab02a.getYbab02a060());
            // 将传入的对象所有非空属性都更新到数据库中
            boolean result = ybab02aService.save(ybab02a);

            if (result) {
                return SysResult.success("操作成功");
            } else {
                return SysResult.success("操作失败");
            }
        }
    }

//    @ApiOperation("因子权重配置--短临/短期山东--查询")
//    @PostMapping("/getFactorConfiguration")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query"),
//            @ApiImplicitParam(name = "modelIndex", value = "模型代码：短临00000，短期00002/00006", required = true, defaultValue = "", dataType = "String", paramType = "query")
//    })
//    public SysResult getFactorConfiguration(String advcode, String modelIndex) {
//        // 创建一个Wrapper对象
//        String ybab02a020 = modelIndex;
//        String ybab02a040 = "dl_";//短临模型
//        if (modelIndex.equals("00002"))
//            ybab02a040 = "dq_";//简单模型
//        else if (modelIndex.equals("00006"))
//            ybab02a040 = "dq_";//基础模型
//        Wrapper<Ybab02a> wrapper;
//        if (advcode.endsWith("0000")) {
//            wrapper = new LambdaQueryWrapper<Ybab02a>()
//                    .eq(Ybab02a::getYbab02a020, ybab02a020)
//                    .likeRight(Ybab02a::getYbab02a040, ybab02a040)
//                    .isNull(Ybab02a::getYbab02a060);
//        } else {
//            wrapper = new LambdaQueryWrapper<Ybab02a>()
//                    .eq(Ybab02a::getYbab02a020, ybab02a020)
//                    .likeRight(Ybab02a::getYbab02a040, ybab02a040)
//                    .eq(Ybab02a::getYbab02a060, advcode);
//        }
//        List<Ybab02a> list = ybab02aService.list(wrapper);
//        if (list.size() == 0) {
//            Wrapper<Ybab02a> wrapper1 = new LambdaQueryWrapper<Ybab02a>()
//                    .eq(Ybab02a::getYbab02a020, ybab02a020)
//                    .likeRight(Ybab02a::getYbab02a040, ybab02a040)
//                    .isNull(Ybab02a::getYbab02a060);
//            List<Ybab02a> list1 = ybab02aService.list(wrapper1);
//            for (Ybab02a ybab : list1) {
//                Ybab02a ybab02a = new Ybab02a();
//                ybab02a.setYbab02a010(java.util.UUID.randomUUID().toString().replace("-", ""));
//                ybab02a.setYbab02a020(ybab.getYbab02a020());
//                ybab02a.setYbab02a030(ybab.getYbab02a030());
//                ybab02a.setYbab02a040(ybab.getYbab02a040());
//                ybab02a.setYbab02a050(ybab.getYbab02a050());
//                ybab02a.setYbab02a060(advcode);
//                ybab02aService.save(ybab02a);
//            }
//            list = ybab02aService.list(wrapper);
//
//        }
//        return SysResult.success(list);
//    }

    @ApiOperation("因子显示参数--短临/短期参数配置--查询")
    @PostMapping("/getDLFactorDisplayParameters")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "advcode", value = "行政编码", required = true, defaultValue = "", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "modelIndex", value = "模型代码", required = true, defaultValue = "", dataType = "String", paramType = "query")
    })
    public SysResult getDLFactorDisplayParameters(String advcode, String modelIndex) {
//        String ybab01c020 = "-2";//短期
//        if (modelIndex.equals("00000"))
//            ybab01c020 = "-3";//短临

        // 创建一个Wrapper对象
        Wrapper<Ybab01c> wrapper;
        if (advcode.endsWith("0000")) {
            wrapper = new LambdaQueryWrapper<Ybab01c>()
//                    .eq(Ybab01c::getYbab01c020, ybab01c020)
                    .eq(Ybab01c::getYbab01c050, modelIndex)
                    .and(wrap -> wrap.isNull(Ybab01c::getYbab01c060).or().eq(Ybab01c::getYbab01c060, ""))
                    .orderByAsc(Ybab01c::getYbab01c030);
        } else {
            wrapper = new LambdaQueryWrapper<Ybab01c>()
//                    .eq(Ybab01c::getYbab01c020, ybab01c020)
                    .eq(Ybab01c::getYbab01c050, modelIndex)
                    .eq(Ybab01c::getYbab01c060, advcode)
                    .orderByAsc(Ybab01c::getYbab01c030);
        }
        List<Ybab01c> list = ybab01cService.list(wrapper);
        return SysResult.success(list);
    }

    @ApiOperation("因子显示参数--短临/短期参数配置--新增(060字段传行政编码，省传空)")
    @PostMapping("/saveDLFactorDisplayParameters")
    public SysResult saveDLFactorDisplayParameters(@RequestBody Ybab01c ybab01c) {
        ybab01c.setYbab01c010(java.util.UUID.randomUUID().toString().replace("-", ""));
        if (ybab01c.getYbab01c060().endsWith("0000")) {
            ybab01c.setYbab01c060("");
        }
        boolean result = ybab01cService.save(ybab01c);

        if (result) {
            return SysResult.success("操作成功");
        } else {
            return SysResult.success("操作失败");
        }
    }

    @ApiOperation("因子显示参数--短临/短期参数配置--删除")
    @PostMapping("/delDLFactorDisplayParameters")
    public SysResult delDLFactorDisplayParameters(String id) {

        if (id.equals(""))
            return SysResult.success("删除失败,id为空");

        boolean result = ybab01cService.remove(new LambdaQueryWrapper<Ybab01c>().eq(Ybab01c::getYbab01c010, id));

        if (result) {
            return SysResult.success("删除成功");
        } else {
            return SysResult.success("删除失败");
        }
    }

    @ApiOperation("因子显示参数--短临/短期参数配置--修改")
    @PostMapping("/upDLFactorDisplayParameters")
    public SysResult upDLFactorDisplayParameters(@RequestBody Ybab01c ybab01c) {
        // 创建UpdateWrapper实例并设置要更新的对象作为主键条件
        UpdateWrapper<Ybab01c> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("ybab01c010", ybab01c.getYbab01c010()); // Ybab01a的主键字段

        if (ybab01c.getYbab01c060().endsWith("0000")) {
            ybab01c.setYbab01c060("");
        }
        // 将传入的对象所有非空属性都更新到数据库中
        boolean result = ybab01cService.update(ybab01c, updateWrapper);

        if (result) {
            return SysResult.success("更新成功");
        } else {
            return SysResult.success("更新失败");
        }
    }

    @DS("slave_qxdata")
    @ApiOperation("通讯录树结构")
    @GetMapping("/depttree")
    public SysResult depttree(String advcode) {
        if (advcode == null)
            return SysResult.fail("advcode为空");
        List<AreaTree> list = messageSendService.getTree(advcode);
        return SysResult.success(list);
    }


    /**
     * 添加部门
     *
     * @param sysDept
     * @return
     */
    @DS("slave_qxdata")
    @ApiOperation("添加部门")
    @PostMapping("/sys_dept_add")
    public SysResult sys_dept_add(@RequestBody Ggsy02a sysDept) {
        boolean success = messageSendService.sys_dept_add(sysDept);
        return SysResult.success(success);
    }

    /**
     * 查询部门信息
     *
     * @param id 部门id （ggsy02a010）
     * @return
     */
    @DS("slave_qxdata")
    @ApiOperation("查询部门")
    @GetMapping("/sys_dept_get")
    public SysResult sys_dept_get(String id) {
        Ggsy02a sysDept = messageSendService.sys_dept_get(id);
        if (Objects.isNull(sysDept)) {
            return SysResult.fail("无对应部门信息");
        } else {
            return SysResult.success(sysDept);
        }
    }

    /**
     * 修改部门信息
     *
     * @param sysDept 部门信息对象
     * @return
     */
    @DS("slave_qxdata")
    @ApiOperation("修改部门")
    @PostMapping("/sys_dept_update")
    public SysResult sys_dept_update(@RequestBody Ggsy02a sysDept) {
        boolean result = messageSendService.sys_dept_update(sysDept);
        if (result) {
            return SysResult.success("更新成功");
        } else {
            return SysResult.success("更新失败");
        }
    }

    /**
     * 逻辑删除部门
     *
     * @param id 部门id  （ggsy02a010）
     * @return
     */
    @DS("slave_qxdata")
    @ApiOperation("删除部门")
    @GetMapping("/sys_dept_delete")
    public SysResult sys_dept_delete(String id) {
        boolean result = messageSendService.sys_dept_delete(id);
        if (result) {
            return SysResult.success("删除成功");
        } else {
            return SysResult.success("删除失败");
        }
    }

    /**
     * 查询通讯录人员列表
     *
     * @param ggsy02bVO 通讯录人员表(Ggsy02b)实体类
     * @return
     */
    @DS("slave_qxdata")
    @ApiOperation("通讯录-查询通讯录人员列表")
    @PostMapping("/selectAddressBookPersonnel")
    public SysResult selectAddressBookPersonnel(@RequestBody Ggsy02bVO ggsy02bVO) {
        List<Ggsy02bVO> ggsy02bs = ggsy02bService.selectGgsy02bList(ggsy02bVO);
        if (ggsy02bs.size() > 0) {
            return SysResult.success(ggsy02bs);
        } else {
            return SysResult.fail("没有对应的通讯录人员数据");
        }
    }

    /**
     * 新增通讯录人员
     *
     * @param ggsy02b 通讯录人员表(Ggsy02b)实体类
     * @return
     */
    @DS("slave_qxdata")
    @ApiOperation("通讯录-新增通讯录人员")
    @PostMapping("/addAddressBookPersonnel")
    public SysResult addAddressBookPersonnel(@RequestBody Ggsy02b ggsy02b) {
        if (Objects.isNull(ggsy02b.getGgsy02b015())) {
            return SysResult.fail("无工作单位id，新增失败！");
        }
        return ggsy02bService.insertGgsy02b(ggsy02b);

    }

    /**
     * 修改通讯录人员
     *
     * @param ggsy02b 通讯录人员表(Ggsy02b)实体类
     * @return
     */
    @DS("slave_qxdata")
    @ApiOperation("通讯录-修改通讯录人员")
    @PostMapping("/updateAddressBookPersonnel")
    public SysResult updateAddressBookPersonnel(@RequestBody Ggsy02b ggsy02b) {
        int flag = ggsy02bService.updateGgsy02b(ggsy02b);
        if (flag > 0) {
            return SysResult.success("修改通讯录人员成功");
        } else {
            return SysResult.fail("修改通讯录人员失败");
        }
    }

    /**
     * 真实删除通讯录人员（非逻辑删除）
     *
     * @param ggsy02b010 主键id
     * @return
     */
    @DS("slave_qxdata")
    @ApiOperation("通讯录-删除通讯录人员")
    @GetMapping("/deleteAddressBookPersonnel")
    public SysResult deleteAddressBookPersonnel(Long ggsy02b010) {
        int flag = ggsy02bService.deleteGgsy02bOneById(ggsy02b010);
        if (flag > 0) {
            return SysResult.success("删除通讯录人员成功");
        } else {
            return SysResult.fail("删除通讯录人员失败");
        }
    }

    /**
     * 真实批量删除通讯录人员（非逻辑删除）
     *
     * @param ggsy02b010s 主键id数组
     * @return
     */
    @DS("slave_qxdata")
    @ApiOperation("通讯录-批量删除通讯录人员")
    @PostMapping("/batchRemoveAddressBookPersonnel")
    public SysResult batchRemoveAddressBookPersonnel(@RequestBody List<Long> ggsy02b010s) {
        int flag = ggsy02bService.batchRemoveGgsy02b(ggsy02b010s);
        if (flag > 0) {
            return SysResult.success("批量删除通讯录人员成功");
        } else {
            return SysResult.fail("批量删除通讯录人员失败");
        }
    }

    /**
     * 导出通讯录人员
     *
     * @param ggsy02bVO
     * @param response
     */
    @DS("slave_qxdata")
    @ApiOperation("通讯录-导出通讯录人员")
    @PostMapping("/GenerateGgsy02bExcel")
    public void generateGgsy02bExcel(@RequestBody Ggsy02bVO ggsy02bVO, HttpServletResponse response) throws IOException {
        List<Ggsy02bVO> ggsy02bVOList = ggsy02bService.selectGgsy02bList(ggsy02bVO);

        ExcelUtil<Ggsy02bVO> excelUtil = new ExcelUtil<>(Ggsy02bVO.class);
        excelUtil.exportExcel(response, ggsy02bVOList, "addressBookPersonnel", "sheet1");
    }

    /**
     * 下载导入通讯录人员模板
     *
     * @param response
     */
    @DS("slave_qxdata")
    @ApiOperation("通讯录-下载导入通讯录人员模板")
    @PostMapping("/importGgsy02bTemplate")
    public void importGgsy02bTemplate(HttpServletResponse response) throws IOException {
        List<Ggsy02bVO> ggsy02bVOList = null;

        ExcelUtil<Ggsy02bVO> excelUtil = new ExcelUtil<>(Ggsy02bVO.class);
        excelUtil.exportExcel(response, ggsy02bVOList, "template", "sheet1");
    }

    /**
     * 导入通讯录人员数据
     *
     * @param file 文件
     * @return
     * @throws Exception
     */
    @DS("slave_qxdata")
    @ApiOperation("通讯录-导入通讯录人员数据")
    @PostMapping("/importData")
    public SysResult importData(@RequestParam("file") MultipartFile file) throws Exception {
        if (file.isEmpty()) {
            return SysResult.fail("文件为空");
        }

//        文件解析
        ExcelUtil<Ggsy02bVO> excelUtil = new ExcelUtil<>(Ggsy02bVO.class);
        List<Ggsy02bVO> ggsy02bVOList = excelUtil.importExcelUseMultipartFile(file);
//         导入数据
        String res = ggsy02bService.importData(ggsy02bVOList);

        return SysResult.success(res);
    }


    @DS("slave_qxdata")
    @ApiOperation("短信-人员树")
    @GetMapping("/getPersonTree")
    public SysResult personTree(String advcode) {
        if (advcode == null)
            return SysResult.fail("advcode为空");
        List<AreaTree> list = messageSendService.getAllPersonsTree(advcode);
        return SysResult.success(list);
    }


    /**
     * 查询预警消息发送历史记录列表
     */
    @DS("slave_qxdata")
    @ApiOperation(value = "短信-查询预警消息发送历史记录列表")
    @GetMapping("/selecetWarningMessageList")
    public SysResult list(int pageNum, int pageSize, Jkca01gVO jkca01gVO) {
        //可后期引入分页插件解决分页问题，目前分页参数再Jkca01gVO中
//        return SysResult.success(jkca01gService.selectJkca01gPage(pageNum, pageSize, jkca01gVO));
        return SysResult.success(Collections.EMPTY_LIST);
    }

    /**
     * 通过主键查询预警消息发送历史记录单个
     */
    @DS("slave_qxdata")
    @ApiOperation(value = "短信-单个查询预警消息发送历史记录")
    @GetMapping("/selecetWarningMessageOne")
    public SysResult oneById(String jkca01g010) {
        return SysResult.success(jkca01gService.selectJkca01gOneById(jkca01g010));
    }


    /**
     * 新增预警消息发送历史记录
     */
    @DS("slave_qxdata")
    @ApiOperation(value = "短信-新增预警消息发送历史记录")
    @PostMapping("/insertWarningMessage")
    public SysResult add(@RequestBody Jkca01g jkca01g) {
        return SysResult.success(jkca01gService.insertJkca01g(jkca01g));
    }

    /**
     * 修改预警消息发送历史记录
     */
    @DS("slave_qxdata")
    @ApiOperation(value = "短信-修改预警消息发送历史记录")
    @PostMapping("/updateWarningMessage")
    public SysResult edit(@RequestBody Jkca01g jkca01g) {
        return SysResult.success(jkca01gService.updateJkca01g(jkca01g));
    }

    /**
     * 通过主键删除预警消息发送历史记录单个
     */
    @DS("slave_qxdata")
    @ApiOperation(value = "短信-单个删除预警消息发送历史记录")
    @GetMapping("/removeWarningMessage")
    public SysResult removeOneById(String jkca01g010) {
        return SysResult.success(jkca01gService.deleteJkca01gOneById(jkca01g010));
    }

    /**
     * 通过主键批量删除预警消息发送历史记录
     */
    @DS("slave_qxdata")
    @ApiOperation(value = "短信-批量删除预警消息发送历史记录")
    @PostMapping("/removeBatchWarningMessage")
    public SysResult batchRemove(@RequestBody List<String> jkca01g010s) {
        return SysResult.success(jkca01gService.batchRemoveJkca01g(jkca01g010s));
    }

    /**
     * 导出预警消息发送历史记录
     */
    @DS("slave_qxdata")
    @ApiOperation(value = "短信-批量导出预警消息发送历史记录")
    @PostMapping("/generateWarningMessageExcel")
    public void generateWarningMessageExcel(@RequestBody Jkca01gVO jkca01gVO, HttpServletResponse response) throws IOException {
        List<Jkca01g> jkca01gs = jkca01gService.selectJkca01gList(jkca01gVO);
        ExcelUtil<Jkca01g> excelUtil = new ExcelUtil<>(Jkca01g.class);
        excelUtil.exportExcel(response, jkca01gs, "template", "sheet1");
    }


}
